package com.starlink.model.util;

import com.starlink.model.dtomapper.BookReadingRecordDtoMapper;
import com.starlink.model.domain.BookReadingRecordDO;
import com.starlink.model.vo.BookReadingRecordVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class BookReadingRecordConvert {

    public static List<BookReadingRecordVO> buildBookReadingRecordVoList(List<BookReadingRecordDO> bookReadingRecordDOList) {
        if (CollectionUtils.isEmpty(bookReadingRecordDOList)) {
            return Lists.newArrayList();
        }
        List<BookReadingRecordVO> bookReadingRecordVOList = new ArrayList<>();
        for (BookReadingRecordDO bookReadingRecordDO : bookReadingRecordDOList) {
            bookReadingRecordVOList.add(BookReadingRecordDtoMapper.INSTANCE.do2VO(bookReadingRecordDO));
        }

        return bookReadingRecordVOList;
    }
}
